package com.ethink.warehouse.api.component.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
public class WarehouseEtonbaoConfirmOutStockRequest {
    private String apiMethodName;

    private DeliveryOrder deliveryOrder;

    private List<OrderLine> orderLines;

    private List<Package> packages;

    private String responseClass;

    private String version;

    @Data
    public static class DeliveryOrder {
        private Integer confirmType;

        private String deliveryOrderCode;

        private String deliveryOrderId;

        private String expressCode;

        private String logisticsCode;

        private String logisticsName;

        private String orderConfirmTime;

        private String orderType;

        private String outBizCode;

        private String status;

        private String warehouseCode;
    }

    @Data
    public static class OrderLine {
        private Integer actualQty;

        private List<OrderLineBatch> batchs;

        private String inventoryType;

        private String itemCode;

        private String itemId;

        private String outBizCode;
    }

    @Data
    public static class OrderLineBatch {
        private Integer actualQty;

        private String batchCode;

        private String inventoryType;

        @DateTimeFormat(pattern = "yyyy-MM-dd")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
        private Date productDate;

        @DateTimeFormat(pattern = "yyyy-MM-dd")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
        private Date expireDate;
    }

    @Data
    public static class Package {
        private String expressCode;

        private List<PackageItem> items;

        private String logisticsName;

        private String packageCode;

        private List<PackageMaterial> packageMaterialList;
    }

    @Data
    public static class PackageItem {
        private String itemCode;

        private String itemId;

        private Integer quantity;
    }

    @Data
    public static class PackageMaterial {
        private Integer quantity;

        private String type;
    }
}
